<template>
  <div class="root">
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="40%">
      <span>
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="类型">
            <el-input v-model="form.type"></el-input>
          </el-form-item>
          <el-form-item label="项目">
            <el-input v-model="form.project"></el-input>
          </el-form-item>
          <el-form-item label="金额">
            <el-input v-model="form.money"></el-input>
          </el-form-item>
          <el-form-item label="日期">
            <div class="block">
              <el-date-picker
                v-model="form.time"
                type="date"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="选择日期">
              </el-date-picker>
            </div>
          </el-form-item>
          <el-form-item label="备注">
            <el-input type="textarea" v-model="form.remake"></el-input>
          </el-form-item>
        </el-form>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false" size="small">取 消</el-button>
        <el-button type="primary" @click="save" size="small">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      title:"添加",
      dialogVisible:false,
      form:{
        type:"",
        project:"",
        time:'',
        money:"",
        remake:'',
        id:"",
      },
    };
  },
  created: function() {
  },
  methods: {
    save(){
      this.$emit("save",this.form);
    },
    openDialog(row){
      this.dialogVisible = true;
      this.form = {
        type: row.type,
        project:row.project,
        time:row.time,
        money:row.money,
        remake:row.remake,
        id:row.id
      }
    },
    closeDialog(row){
      this.dialogVisible = false;
    }
  }
};
</script>

<style>
.upload {
  width: 200px;
  margin: 20px;
  float: right;
}
.my-pic {
  width: 48px;
  height: 27px;
}
.search {
  width: 50%;
}
.pagination {
  margin-top: 20px;
  margin-right: 50px;
  float: right;
}
.search-by-time {
  margin-top: 20px;
}
.my-btn {
  margin-top: 20px;
  margin-left: 50px;
}
</style>